package server.business.pojo;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;

@Data
@Accessors(chain = true)
@TableName("order_blood")
@ColumnWidth(20) //列宽
@ContentRowHeight(20)//数据行高
@HeadRowHeight(30)//表头高
@ExcelIgnoreUnannotated   //解决不加ExcelProperty注解的，也会出现在excel中
public class BloodOrderData {
    @TableId(type = IdType.AUTO)
    private Long id;    //编号

    @TableField(value = "gmt_create",fill = FieldFill.INSERT)
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    private Date gmtCreate;   //创建时间

    @TableField(value = "gmt_modified", fill = FieldFill.UPDATE)
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    private Date gmtModified;    //更新时间

    @TableField(value = "number")
    @ExcelProperty(value = "单号",index = 0)
    private String number;      //单号
    
    @TableField(value = "apply_company")
    @ExcelProperty(value = "申请单位",index = 1)
    private String applyCompany;     //申请单位
    
    @TableField(value = "blood_type")
    @ExcelProperty(value = "血液类型",index = 2)
    private String bloodType;      //申请的血液类型
    
    @TableField(value = "blood_volume")
    @ExcelProperty(value = "申请血量",index = 3)
    private BigDecimal bloodVolume;     //申请的血量
    
    @TableField(value = "applicant")
    @ExcelProperty(value = "申请人",index = 4)
    private String applicant;   //申请人
    
    @TableField(value = "applicant_number")
    @ExcelProperty(value = "申请人工号",index = 5)
    private String applicantNumber;     //申请人工号
    
    @TableField(value = "apply_time")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @ExcelProperty(value = "申请工号",index = 6)
    private Date applyTime;     //申请日期
    
    @TableField(value = "blood_price")
    @ExcelProperty(value = "金额",index = 7)
    private BigDecimal bloodPrice;      //血液单价
    
    @TableField(value = "auditor")
    @ExcelProperty(value = "审核人",index = 8)
    private String auditor;     //审核人
    
    @TableField(value = "audit_time")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @ExcelProperty(value = "审核时间",index = 9)
    private Date auditTime;     //审核时间
    
    @TableField(value = "auditor_number")
    @ExcelProperty(value = "审核人工号",index = 10)
    private String auditorNumber;      //审核人工号
    
    @TableField(value = "state")
    @ExcelProperty(value = "状态",index = 11)
    private String state;   //状态
    
    @TableField(value = "measurement_unit")
    private Integer measurementUnit;    //计量单位
    
    @TableField(value = "cart_amount")
    private Integer cartAmount;     //数量
    
    @TableField(value = "total_money")
    private BigDecimal totalMoney;      //商品总价

    @TableLogic(value = "0", delval = "1")
    @TableField(value = "is_deleted", fill = FieldFill.INSERT)
    private int isDeleted;     //删除标记（0代表未删除，1代表删除）

    @TableField(value = "abo_blood_type")
    private String aboBloodType;    //ABO血型

    @TableField(value = "rh_blood_type")
    private String rhBloodType;     //RH血型

    @TableField(value = "serial_number")
    private String serialNumber;     //自编流水号
    
    @TableField(exist = false)
    private String stateInfo;   //血液订单中文含义
    
    @TableField(exist = false)
    private String aboInfo;     //abo血型含义
    
    @TableField(exist = false)
    private String rhInfo;  //rh血型含义
    
    @TableField(exist = false)
    private String typeInfo;    //血液类型含义
}
